import { DbContext } from '@codefree/badger/service'
const db = DbContext.Sequelize;

export type DictionaryEntity = {
    key: Number,
    value: String,
    description: String,
    active: Boolean
}

// 定义Sequelize Model
const dictionaryEntity: DictionaryEntity = {
    key: db.INTEGER,
    value: db.STRING(100),
    description: db.STRING(500),
    active: {
        type: db.BOOLEAN,
        defaultValue: true
    }
}

export default (sequelize) => {
    return {
        name: 'Dictionary',
        define: sequelize.define("dictionary", dictionaryEntity, DbContext.defaultOptions)
    }
}
